﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MQ.Core.Common;
using MQ.Core.IService.System;

namespace MQ.Core.Admin.Areas.System.Controllers
{
    /// <summary>
    /// 日志
    /// </summary>
    [Route("api/system/[controller]")]
    public class LogController : ApiController
    {
        private readonly ILogService logService;
        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="logService"></param>
        public LogController(ILogService logService)
        {
            this.logService = logService;
        }
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="pagination"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("page")]
        public object GetPageList([FromQuery]Pagination pagination,[FromQuery]string query)
        {
            var data = logService.GetPageList(pagination, query);
            return Success(pagination, data);
        }
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("list")]
        public object GetList([FromQuery]string query)
        {
            var data = logService.GetList(query);
            return Success(data);
        }
    }
}